package com.zshy.base.monitor.domain.contract.command;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 图文类型
 * {
 * "msgtype": "news",
 * "news": {
 * "articles" : [
 * {
 * "title" : "中秋节礼品领取",
 * "description" : "今年中秋节公司有豪礼相送",
 * "url" : "www.qq.com",
 * "picurl" : "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png"
 * }
 * ]
 * }
 * }
 *
 * @author zhouhengzhe
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SendMessageByNewsCommand {

    @NotEmpty(message = "articles不能为空")
    @Size(min = 1, max = 8, message = "一个图文消息支持1到8条图文")
    private List<Article> articles;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    public static class Article {
        /**
         * 标题，不超过128个字节，超过会自动截断
         */
        @NotBlank(message = "标题不能为空")
        private String title;

        /**
         * 描述，不超过512个字节，超过会自动截断
         */
        private String description;
        /**
         * 点击后跳转的链接。
         */
        @NotBlank(message = "url不能为空")
        private String url;
        /**
         * 图文消息的图片链接，支持JPG、PNG格式，较好的效果为大图 1068*455，小图150*150。
         */
        private String picUrl;
    }

}
